{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 最值归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([93, 61, 20, 38, 42, 96, 39, 23, 47, 99, 37, 92, 22, 39, 70, 14, 64,\n",
       "       61, 52, 72, 40, 20, 11,  6, 86, 49, 57, 58, 66, 25,  9, 46, 60, 43,\n",
       "       93, 16, 27, 26, 29, 36, 55, 55, 63, 62, 26, 70, 15, 81, 20, 11, 37,\n",
       "       15, 43,  9, 22, 32, 59, 99, 36, 49, 40, 75, 21, 90, 78, 68, 92, 47,\n",
       "       33, 55, 27, 70,  8, 82, 59, 74, 81,  3, 19, 26, 24, 58, 80,  2, 11,\n",
       "       41, 40, 92, 15, 18,  9, 83, 54,  1, 55,  7, 44, 24, 29, 26])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = np.random.randint(0, 100, size = 100)\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.08163265, 0.89795918, 0.05102041, 0.09183673, 0.39795918,\n",
       "       0.89795918, 0.7244898 , 0.51020408, 0.09183673, 0.37755102,\n",
       "       0.12244898, 0.07142857, 0.37755102, 0.31632653, 0.46938776,\n",
       "       0.63265306, 0.52040816, 0.05102041, 0.46938776, 0.7755102 ,\n",
       "       0.53061224, 0.63265306, 0.36734694, 0.33673469, 0.21428571,\n",
       "       0.93877551, 0.57142857, 0.12244898, 0.98979592, 0.85714286,\n",
       "       0.40816327, 0.5       , 0.75510204, 0.18367347, 0.35714286,\n",
       "       0.56122449, 0.60204082, 0.73469388, 0.13265306, 0.31632653,\n",
       "       0.78571429, 0.7755102 , 0.16326531, 0.25510204, 0.82653061,\n",
       "       0.86734694, 0.51020408, 0.7755102 , 0.78571429, 0.05102041,\n",
       "       0.8877551 , 0.85714286, 0.01020408, 1.        , 0.6122449 ,\n",
       "       0.05102041, 0.33673469, 0.78571429, 0.63265306, 0.98979592,\n",
       "       0.        , 0.92857143, 0.29591837, 0.30612245, 0.68367347,\n",
       "       0.31632653, 0.41836735, 0.58163265, 0.33673469, 0.92857143,\n",
       "       0.29591837, 0.08163265, 0.93877551, 0.54081633, 0.36734694,\n",
       "       0.42857143, 0.84693878, 0.69387755, 0.02040816, 0.43877551,\n",
       "       0.79591837, 0.92857143, 0.08163265, 0.82653061, 0.35714286,\n",
       "       0.92857143, 0.07142857, 0.7755102 , 0.14285714, 0.08163265,\n",
       "       0.2755102 , 0.37755102, 0.48979592, 0.7244898 , 0.2755102 ,\n",
       "       0.37755102, 0.70408163, 0.51020408, 0.81632653, 0.60204082])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(x - np.min(x)) / (np.max(x) - np.min(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[95, 13],\n",
       "       [40, 93],\n",
       "       [92, 37],\n",
       "       [45, 68],\n",
       "       [62, 91],\n",
       "       [80, 74],\n",
       "       [19, 44],\n",
       "       [58, 38],\n",
       "       [71, 26],\n",
       "       [85,  9],\n",
       "       [23, 22],\n",
       "       [11,  9],\n",
       "       [32, 36],\n",
       "       [45, 99],\n",
       "       [83, 53],\n",
       "       [93,  2],\n",
       "       [19, 52],\n",
       "       [38, 21],\n",
       "       [ 9, 10],\n",
       "       [78, 78],\n",
       "       [60, 64],\n",
       "       [24, 57],\n",
       "       [ 6, 46],\n",
       "       [29, 10],\n",
       "       [89, 51],\n",
       "       [42,  5],\n",
       "       [ 9, 68],\n",
       "       [86, 66],\n",
       "       [64, 79],\n",
       "       [16, 35],\n",
       "       [34, 22],\n",
       "       [15, 51],\n",
       "       [53, 67],\n",
       "       [80, 20],\n",
       "       [11, 38],\n",
       "       [ 3, 37],\n",
       "       [18, 92],\n",
       "       [77, 13],\n",
       "       [45, 98],\n",
       "       [44, 88],\n",
       "       [ 7, 50],\n",
       "       [43, 82],\n",
       "       [50, 72],\n",
       "       [99, 93],\n",
       "       [24, 73],\n",
       "       [93, 19],\n",
       "       [84, 45],\n",
       "       [82, 64],\n",
       "       [99, 96],\n",
       "       [24, 45]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = np.random.randint(0, 100, (50, 2))\n",
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = np.array(X, dtype = float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "X[:, 0] = (X[:,0] - np.min(X[:,0])) / (np.max(X[:,0])-np.min(X[:,0]))\n",
    "X[:, 1] = (X[:,1] - np.min(X[:,1])) / (np.max(X[:,1])-np.min(X[:,1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.95833333, 0.11340206],\n",
       "       [0.38541667, 0.93814433],\n",
       "       [0.92708333, 0.36082474],\n",
       "       [0.4375    , 0.68041237],\n",
       "       [0.61458333, 0.91752577],\n",
       "       [0.80208333, 0.74226804],\n",
       "       [0.16666667, 0.43298969],\n",
       "       [0.57291667, 0.37113402],\n",
       "       [0.70833333, 0.24742268],\n",
       "       [0.85416667, 0.07216495],\n",
       "       [0.20833333, 0.20618557],\n",
       "       [0.08333333, 0.07216495],\n",
       "       [0.30208333, 0.35051546],\n",
       "       [0.4375    , 1.        ],\n",
       "       [0.83333333, 0.5257732 ],\n",
       "       [0.9375    , 0.        ],\n",
       "       [0.16666667, 0.51546392],\n",
       "       [0.36458333, 0.19587629],\n",
       "       [0.0625    , 0.08247423],\n",
       "       [0.78125   , 0.78350515],\n",
       "       [0.59375   , 0.63917526],\n",
       "       [0.21875   , 0.56701031],\n",
       "       [0.03125   , 0.45360825],\n",
       "       [0.27083333, 0.08247423],\n",
       "       [0.89583333, 0.50515464],\n",
       "       [0.40625   , 0.03092784],\n",
       "       [0.0625    , 0.68041237],\n",
       "       [0.86458333, 0.65979381],\n",
       "       [0.63541667, 0.79381443],\n",
       "       [0.13541667, 0.34020619],\n",
       "       [0.32291667, 0.20618557],\n",
       "       [0.125     , 0.50515464],\n",
       "       [0.52083333, 0.67010309],\n",
       "       [0.80208333, 0.18556701],\n",
       "       [0.08333333, 0.37113402],\n",
       "       [0.        , 0.36082474],\n",
       "       [0.15625   , 0.92783505],\n",
       "       [0.77083333, 0.11340206],\n",
       "       [0.4375    , 0.98969072],\n",
       "       [0.42708333, 0.88659794],\n",
       "       [0.04166667, 0.49484536],\n",
       "       [0.41666667, 0.82474227],\n",
       "       [0.48958333, 0.72164948],\n",
       "       [1.        , 0.93814433],\n",
       "       [0.21875   , 0.73195876],\n",
       "       [0.9375    , 0.17525773],\n",
       "       [0.84375   , 0.44329897],\n",
       "       [0.82291667, 0.63917526],\n",
       "       [1.        , 0.96907216],\n",
       "       [0.21875   , 0.44329897]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAVrUlEQVR4nO3df4wcZ33H8c8Hh8C1DVyF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9GxG/aTx9R68bdqcry3UrSZyR9VtJviwxuBLIc74ckHY6IZyQpIp4uOMY8ZTnekPSq9uNXa/lN6JMREd9X6zacK9kt6cvR8oikcduvy+vzU0nok5LOdjyfb2/ruU9EvCDpWUmvKSS6fGU51k63qfUXP1V9j9f2dkkbI+I7RQY2Ilm+36slXW37YduP2N5VWHT5y3K8n5b0ftvzat3q8qPFhFaKQX+/B5LpnqIV0KvS7h5vmWWfFGQ+DtvvlzQl6W0jjWi0Vj1e2y+T9DlJHywqoBHL8v1epla3y9vVan39p+1rI+L8iGMbhSzHe6ukeyLi723/iVo3nL82Iv5v9OEVbqR5KpUKfV7Sxo7nG7S8WfbiPrYvU6vptlrTp6qyHKts3yDpk5JuiojfFRTbKPQ73iskXSvpIdtPqdXvOJ3whdGs5/K3I+L5iPippNNqJfgUZTne2yTdJ0kR8QNJr1RrIas6yvT7vVapJPSTkrbY3mz7crUuek537TMt6QPtx7dIOhHtqxCJ6Xus7S6IL6iVzFPuX5X6HG9EPBsR6yNiU0RsUuuawU0RMVNOuEPLci4fU+vCt2yvV6sL5kyhUeYny/H+XNL1kmT7jWol9MVCoyzOtKS/bI92eaukZyPiF7m9e9lXhQe4enyjpP9W64r5J9vb7lTrl1tqnQRflzQn6b8kvaHsmEd4rP8h6X8l/bD9b7rsmEd5vF37PqSER7lk/H4t6R8knZL0hKS9Zcc84uO9RtLDao2A+aGkd5Ud8xDHeq+kX0h6Xq1q/DZJt0u6veO7Pdz+WTyR97nM1H8AqIlUulwAAH2Q0AGgJkjoAFATJHQAqAkSOgDUBAkdAGqChA4ANfH/B0OE1ym625MAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[:,0], X[:,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 均值方归一化 standardization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "X2 = np.random.randint(0, 100, (50, 2))\n",
    "X2 = np.array(X, dtype = float)\n",
    "\n",
    "X2[:,0] = (X2[:,0] - np.mean(X2[:,0])) / np.std(X2[:,0])\n",
    "X2[:,1] = (X2[:,1] - np.mean(X2[:,1])) / np.std(X2[:,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAWdklEQVR4nO3dbYxcV33H8d+vJoQVQmzAGxJvYuyolsuDW0xH5sESSkuog4tiY4gUeEFSJbLSNkWqVEtGSIB4Y6e8qGiTFgyNSPoiCQWyMbWpSXCjtGoTssZJnYcGTArN7kbEJHVQVAuI+ffFzOLJ+s7z3Tv33Pv9SKudh+u5/7k7/s855/7PuY4IAQCq7zfGHQAAoBgkfACoCRI+ANQECR8AaoKEDwA18YpxB9DNypUrY82aNeMOAwCSceTIkZ9GxFTWc6VO+GvWrNHs7Oy4wwCAZNj+cafnGNIBgJog4QNATZDwAaAmSPgAUBMkfACoCRI+ANREqcsygTzMHJ3X5w49qYWTp7RqckK7tqzX9o3T4w4LKBwJH5U2c3Ren/jGMZ365WlJ0vzJU/rEN45JEkkftcOQDirtc4ee/HWyX3Tql6f1uUNPjikiYHxI+Ki0+ZOnBnocqDISPipthT3Q40CVkfBRaac7XMKz0+NAlXHSFpU2PTmROXwzPTkxhmiAzoqoJqOFj0rbtWW9Js5Z8bLHJs5ZoV1b1o8pIuBsi9Vk8ydPKXSmmmzm6Hyu+yHho9K2b5zWnh0bND05IavZst+zYwMlmSi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Hvx/fUXOPmRdtbJc1IWld0EMkn/Ii4LIfXWGj9ftb2XWp2jwtJ+DnEPyepvaV2kaSFEV+zL91it/0T2xdGxDOtbvezHV5j8dg/Zfs+SRvVHIseh36O5eI2c7ZfIem1KkdXvmfsEfFc290vSbqxgLjyNLbP+qgi4mdttw/a/lvbKyOi0AXhaj+kY/vVtl+zeFvSH0jKPNNeUg9JWmd7re1XqnkicezVLmrGcHXr9tWSzuqt2D7P9rmt2yslbZb0eGERnq2fY9n+vj4s6XC0zsqNWc/Yl4x3XyHpiQLjy8N+SR9rVeu8U9ILi8OGZWf7gsVzPbY3qZl7n+v+r5bBuM8aL+ePpA+q2Sr4uaSfSDrUenyVpIOt25eoWdHwiKTH1BxKGXvs/cbfur9V0vfVbBmXIn41x7W/I+kHrd+vaz3ekPTl1u13SzrWOvbHJF1bgrjPOpaSPivpitbtV0n6R0nHJX1X0iXjjnmA2Pe0PuOPSPoXSb817piXxH+7pGck/bL1ub9W0vWSrm89b0k3t97fMXWpvCth7De0HfsHJL17HHGytAIA1ETth3QAoC5I+ABQEyR8AKgJEj4A1AQJHwBqgoQPADVBwgeAmvh/KjAiajDPNd8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X2[:,0], X2[:,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.771561172376095e-17"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(X2[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(X2[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
